package com.ccjq.jq173.member.service.impl;

import com.ccjq.jq173.core.util.Md5Utils;
import com.ccjq.jq173.member.dao.impl.UserDaoImpl;
import com.ccjq.jq173.member.dao.userdao;
import com.ccjq.jq173.member.po.User;
import com.ccjq.jq173.member.service.UserService;

public class UserServiceImpl implements UserService {
    private userdao userDao;
    public UserServiceImpl()
    {
        userDao=new UserDaoImpl();
    }
    @Override
    public User login(String username, String password) {
        password= Md5Utils.encoderByMd5(password);
        User u=userDao.findUser_byname_and_password(username,password);
        return u;
    }

    @Override
    public int regist(String username, String password, String mobilePhone) {
        password= Md5Utils.encoderByMd5(password);
        int result=userDao.saveUser(username,password,mobilePhone);
        return result;
    }

    @Override
    public User findUser(String userName) {
        User user=userDao.findUserByName(userName);
        return user;
    }
}
